<?php

namespace app\api\validate;

use think\Validate;

class Admin extends Validate
{
    protected $failException = true;

    protected $rule = [
        'username' => 'require|unique:admin',
        'nickname'=>'require',
        'password' => 'require',
        'profit_rate'=>'require'
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'login'             => ['username.require', 'password'],
        'add'   => ['username','nickname','password','mobile'],
        'edit' => ['nickname','mobile'],
        'retrievePassword' => ['account', 'captcha', 'password'],
    ];

    public function __construct()
    {
        $this->field   = [
        	'username' =>'账号',
        	'password' => '密码',
            'mobile'=>'手机',
            'nickname'=>'名称',
            'profit_rate'=>'分账比例'
        ];

        parent::__construct();
    }
}